package com.key.common.utils;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author wen
 * @create 2023-02-20 9:21
 */
public class OddNumbersUtils {

    static public String creatON(String clazz){
        String ON=clazz+"-"+System.currentTimeMillis();
        return ON;
    }

    static public  String getDay(){
        SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd");
        Date date = new Date(System.currentTimeMillis());
        return formatter.format(date);
    }

    static public  String toDay(Timestamp timestamp){
        SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd");
        Date date = new Date(timestamp.getTime());
        return formatter.format(date);
    }

    /**
     * @Author: ljh
     * @Description:获取任意月后的时间
     * @DateTime: 18:52 2022/11/23
     * @Params: mon 1表示后一个月 -1表示前一个月
     * @Return
     */
    public static String getMon(int mon){
        Calendar calendar2 = Calendar.getInstance();
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
        calendar2.add(Calendar.MONTH, mon);
        String date = sdf2.format(calendar2.getTime());
        return date;
    }

}
